var testObj={
  avModel:null,
  loadEleModel:function(name){
	  //C4执勤楼2层
	  //g3d.dm().clear();
	  let fileFullPath='scenes/' + name + '.json';
	  dataModel.deserialize(fileFullPath);
	  window.addEventListener('resize3d', function(e) {
				g3d.invalidate(); //在浏览器大小改变是重新3D视图
			}, false);
	  g3d.setCenter([0, 0, 0]); //设置中心点位置
	  g3d.setEye([0, 9500, 5000]); //设置视角位置
	  g3d.setFar(10000000);
	  try{
			/* ht.Default.xhrLoad(
				'scenes/' + name + '.json',
				function(text) {
					const json = ht.Default.parse(text);
					g3d.addToDOM();
					map.modelJson=json;
					if (json) {
						//记录当前的模型文件名称
			            modelMap.curModelFileName=name;
						modelMap.curModelId=modelMap.modelFileNameMappingModelId[name];
                        modelMap.curModelIdPrefix=modelMap.getModelIdPrefix(modelMap.curModelId);
						let modelLevelName=modelMap.match(modelMap.curModelFileName);
					    modelConfig.modelLevelName=modelLevelName;
								
						if (modelLevelName=='园区'){
							map.isInOut=true;
							vm.level2="";
							vm.level3="";
						}
						else if (modelLevelName=='building'){
							map.isInOut=false;
							vm.level2=name;
							vm.level3="";
						}
						else{//三层			
						    map.isInOut=false;
							vm.level2=modelMap.getParentModelName(name);
							vm.level3=name;
						}						
					} else {
						console.log('获取模型【'+name+'】错误！');
					}
				}
			) */
			//设备背景色
			//g3d.dm().setBackground(buildBackGroundColor);
			
			
			//在序列化之前，先设定eye等参数，避免晃眼！
			/* let mId = modelMap.modelFileNameMappingModelId[name];			
				//设定模型视角
			$.ajax({
				url: '/jg-api/model/getModelInfo',
				type: 'post',
				async:true,
				data: {
					modelId: mId
				},
				success: function (res) {				
					if(res.success) {
						if(res.data && res.data[0]) {
							//modelConfig.setConfig(res.data,mId);
							var data = res.data[0];	
							g3d.setCenter([0,0,0]);    							
							if (data.far){
								g3d.setFar(data.far*1);
							}
							if (data.near){
								g3d.setNear(data.near*1);
							}					
							if (mId=='JG001' && data.xg3dcenter){
								g3d.setCenter([data.xg3dcenter*1,data.yg3dcenter*1,data.zg3dcenter*1]);
							}
							
							if(data.xview && data.yview && data.zview) {
								g3d.setEye(data.xview*1, data.yview*1, data.zview*1);								
							}
													
						}
					}
				}
			}) */
		}
		catch(exception){
			console.log(exception.message);
		}
  },
  loadobj:function(){
      ht.Default.loadObj('/eledemo/jjr.obj', '/eledemo/jjr.mtl', {
			center: true,
			r3: [0, -Math.PI / 2, 0], // make model face right
			s3: [1, 1, 1], // make moddel smaller
			finishFunc: function(mm, array, rawS3) {
				if (mm) {
					// add a sphere model as an indicator light
					array.push({
						shape3d: ht.Default.createSmoothSphereModel(),
						t3: [-40, 10, 0],
						s3: [6, 6, 6],
						color: {
							func: function(data) {
								return data.a('light') ? 'red' : 'black';
							}
						}
					});
					ht.Default.setShape3dModel('sphere', array);
					//elePatrolObj.createPatrolModel(rawS3);
					testObj.avModel = new ht.Node();
					testObj.avModel.s3(10, 10, 10);
			        testObj.avModel.s3(rawS3);
					testObj.avModel.s({
						'shape3d': 'sphere',
						'shape3d.scaleable': false,
						'wf.visible': true,
						'wf.color': 'white',
						'wf.short': true
					});
					testObj.avModel.a({
						'angle': 0,
						'light': false
					});
					dataModel.add(testObj.avModel);
				}
			}
	   });
  }	  
};